package uk.co.davedexter.FlickrManager;

import java.io.File;
import java.io.IOException;
import java.util.Collection;

import joptsimple.OptionParser;
import joptsimple.OptionSet;

public class FlickrManager {

	FlickrManager(String[] args) {

		try {
			OptionParser parser = new OptionParser() {
				{
					acceptsAll(java.util.Arrays.asList("h", "help"), "Show this help");
					acceptsAll(java.util.Arrays.asList("p", "photos"), "Specify the photos directory.")
							.withRequiredArg().describedAs("PhotosDirectory").defaultsTo("/media/1-5_DAS/photos");
					acceptsAll(java.util.Arrays.asList("r", "remove-from-db"),
							"Remove images matching the specified regex.").withRequiredArg().describedAs("RegExMatch")
							.ofType(String.class);
					acceptsAll(java.util.Arrays.asList("n", "print-new"), "Display new images not yet in the database.");
					acceptsAll(java.util.Arrays.asList("u", "upload-new"), "Uploads new images.");
					acceptsAll(java.util.Arrays.asList("i", "print-uploaded"),
							"Print all the currently uploaded local files in the database.");
					acceptsAll(java.util.Arrays.asList("t", "fix-titles"),
							"Fix all titles of the uploaded images to be YYYY-MM-DD HH:MM. Imagename");
					acceptsAll(java.util.Arrays.asList("d", "fix-dates"),
							"Fix the dates so that the uploaded date is the same as the taken date.");
					acceptsAll(java.util.Arrays.asList("e", "delete-duplicates"),
							"Delete the images that are duplicates on flickr.");
					acceptsAll(java.util.Arrays.asList("s", "set-property"),
							"Permanently sets a property: NSID, Secret, API Key.").withRequiredArg()
							.describedAs("CommaSeparatedKeyValuePair").ofType(String.class);
				}
			};
			OptionSet options = parser.parse(args);

			// Display help
			if (options.has("h")) {
				parser.printHelpOn(System.out);
			}
			// Set properties
			if (options.has("s")) {
				System.out.println("Setting option:");
			}
			
			
			// Check all required options are set.
			
			// Save options
			

		} catch (IOException ioe) {
			ioe.printStackTrace();
		}
	}

	public static void main(String[] args) {
		FlickrManager manager = new FlickrManager(args);
	}

}
